| API Documentation |  |

- MAIN PAGE
- NAMESPACES
- CLASSES

Static Public Member Functions | List of all members
nkScripts::ContentLoader Class Referencefinal

Allows to export and import content through their declaration files. More...

## Static Public Member Functions
static nkExport::ExporterLoadResult | inputData (nkMemory::StringView filePath)
static nkMemory::String | inputDataStr (nkMemory::StringView filePath)
static nkExport::ExporterLoadResult | inputDataSources (nkMemory::StringView sources)
static bool | outputData (nkMemory::StringView content, nkMemory::StringView path)
static bool | saveTreeDeclaration (nkExport::Node *tree, nkMemory::StringView pathFromData)
static bool | saveObjectDeclaration (nkExport::Exportable *object, nkMemory::StringView pathFromData)
static ContentLoadResultScript | loadScriptDeclaration (nkMemory::StringView pathFromData, bool loadResource=true)
static ContentLoadResultScript | processScriptSources (nkMemory::StringView sources, bool loadResource=true)
static ContentLoadResultScript | processScriptTree (nkExport::Node *tree, bool loadResource=true)

## Detailed Description

Allows to export and import content through their declaration files.

## Member Function Documentation

## ◆ inputData()

static nkExport::ExporterLoadResult nkScripts::ContentLoader::inputData | ( | nkMemory::StringView | filePath | ) |
| static

Inputs data from a file and returns associated tree, if parsing can occur. It will use Json parsing.

Parameters

  filePath | The file path, relative to working directory. See nkResources::ResourceManager for path naming convention.

Returns
  The result after loading designated file.

## ◆ inputDataStr()

static nkMemory::String nkScripts::ContentLoader::inputDataStr | ( | nkMemory::StringView | filePath | ) |
| static

Loads the file into a string for easy access.

Parameters

  filePath | The path of the file to load from.

Returns
  The loaded file in a string.

## ◆ inputDataSources()

static nkExport::ExporterLoadResult nkScripts::ContentLoader::inputDataSources | ( | nkMemory::StringView | sources | ) |
| static

Inputs data from memory and returns associated tree, if parsing can occur. It will use Json parsing.

Parameters

  sources | The sources to parse.

Returns
  The result after loading designated memory chunk.

## ◆ outputData()

static bool nkScripts::ContentLoader::outputData | ( | nkMemory::StringView | content,
|  | nkMemory::StringView | path
| ) |  |
| static

Writes data to a file.

Parameters

  content | The content to write.
  path | The path, relative to working directory, to output the file to. See nkResources::ResourceManager for path naming convention.

Returns
  If the data could succesfully be output (true) or not (false).

## ◆ saveTreeDeclaration()

static bool nkScripts::ContentLoader::saveTreeDeclaration | ( | nkExport::Node * | tree,
|  | nkMemory::StringView | pathFromData
| ) |  |
| static

Saves a tree into a file.

Parameters

  tree | The tree to export.
  pathFromData | The path, relative to working directory, to output the file to. See nkResources::ResourceManager for path naming convention.

Returns
  If the data could succesfully be output (true) or not (false).

## ◆ saveObjectDeclaration()

static bool nkScripts::ContentLoader::saveObjectDeclaration | ( | nkExport::Exportable * | object,
|  | nkMemory::StringView | pathFromData
| ) |  |
| static

Saves an exportable into a file.

Parameters

  object | The object to serialize and export.
  pathFromData | The path, relative to working directory, to output the file to. See nkResources::ResourceManager for path naming convention.

Returns
  If the data could succesfully be output (true) or not (false).

## ◆ loadScriptDeclaration()

static ContentLoadResultScript nkScripts::ContentLoader::loadScriptDeclaration | ( | nkMemory::StringView | pathFromData,
|  | bool | loadResource = `true`
| ) |  |
| static

Loads a Script declaration, from a file.

Parameters

  pathFromData | The file path, relative to working directory. See nkResources::ResourceManager for path naming convention.
  loadResource | If the importing should ultimately load the scripts found or not.

Returns
  The result of the process attempt.

## ◆ processScriptSources()

static ContentLoadResultScript nkScripts::ContentLoader::processScriptSources | ( | nkMemory::StringView | sources,
|  | bool | loadResource = `true`
| ) |  |
| static

Loads a Script declaration, from memory.

Parameters

  sources | The memory chunk to interpret.
  loadResource | If the importing should ultimately load the scripts found or not.

Returns
  The result of the process attempt.

## ◆ processScriptTree()

static ContentLoadResultScript nkScripts::ContentLoader::processScriptTree | ( | nkExport::Node * | tree,
|  | bool | loadResource = `true`
| ) |  |
| static

Loads a Script declaration, from an existing tree.

Parameters

  tree | The tree to interpret.
  loadResource | If the importing should ultimately load the script or not.

Returns
  The result of the process attempt.

The documentation for this class was generated from the following file:

- Documentation/Headers/NilkinsScripts/Exporter/ContentLoader.h